package com.hkts.naturalgas.instrumentdata.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hkts.naturalgas.instrumentdata.entity.Book;
import com.hkts.naturalgas.instrumentdata.mapper.BookMapper;
import com.hkts.naturalgas.instrumentdata.service.BookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @ClassNameTestController
 * @Description
 * @Author yck
 * @Date2020-07-27 11:27
 * @Version V1.0
 **/
@RestController
public class TestController {
  @Autowired
   private BookService bookService;
    @Autowired
    private  BookMapper bookMapper;
  @GetMapping("/instrumentdata/list")
   public List<Book> listBook(){
      QueryWrapper<Book> query = Wrappers.query();
      Page<Book> page = new Page<Book>(1, 2);
      IPage<Book> userIPage = bookMapper.selectPage(page, query);
      List<Book> records = userIPage.getRecords();
      return  bookMapper.customSelect(page).getRecords();
   }

}
